const { Sequelize } = require('sequelize');

// const { sqlLogger } = require("../logger");
// 方法 2: 分别传递参数 (其它数据库)
const sequelize = new Sequelize('studentmanager', 'root', 'YING65123478', {
  host: 'localhost',
  dialect: "mysql",
  /* 选择 'mysql' | 'mariadb' | 'postgres' | 'mssql' 其一 */
  // logging: (msg) => sqlLogger.debug(msg),
});
// async function test(){
//     try {
//         await sequelize.authenticate();
//         console.log('Connection has been established successfully.');
//     } catch (error) {
//         console.error('Unable to connect to the database:', error);
//     }
// }
// test()
module.exports = sequelize;

